home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / sndppr3w.zip / SP.H < prev    next >
C/C++ Source or Header  |  1992-01-24  |  3KB  |  104 lines

  1. /* SP.H
  2. ** 4/26/91
  3. ** mjs
  4. **
  5. ** Header file for the Sandpaper program.
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <malloc.h>
  10. #include <stdlib.h>            /* for _splitpath()        */
  11. #include <string.h>            /* for strlwr()            */
  12. #include <process.h>            /* for exit()            */
  13.  
  14. #define FALSE (0)
  15. #define TRUE (!FALSE)
  16.  
  17. /* Output format flag values    */
  18. #define FMT_NON 0            /* "raw"                        */
  19. #define FMT_NFF    1            /* NFF (MTV)            */
  20. #define FMT_VIV    2            /* Vivid                    */
  21. #define FMT_VIV1    5            /* Vivid    1.0            */
  22. #define FMT_DKB    3            /* DKBTrace (STAR)    */
  23. #define FMT_POV    6            /* PoV Ray - DKB        */
  24. #define FMT_RSH   4            /* Rayshade                */
  25.  
  26. typedef float real;
  27.  
  28. typedef struct {
  29.     real x,y,z;
  30. } Vector;
  31.  
  32. typedef struct pt_node {        /* Point node structure        */
  33.     real x, y, z;            /* point coordinates        */
  34.     real nx, ny, nz;        /* calc'd normals for the point    */
  35.     struct clist_node *cl;        /* ptr to list of using tri's     */
  36.     struct pt_node *next;        /* ptr to next node in list    */
  37. } Point ;
  38.  
  39. typedef struct tri_node {        /* Triangle node structure    */
  40.     Point *p1, *p2, *p3;        /* ptr to 3 Point nodes        */
  41.     real eq_a, eq_b, eq_c;        /* plane eq surface normal    */
  42.     struct tri_node *next;        /* ptr to next node in list    */
  43. } Triangle ;
  44.  
  45. typedef struct clist_node {        /* "Containing List" node stru    */
  46.     struct tri_node *tri;        /* a triangle that uses this pt    */
  47.     struct clist_node *next;    /* ptr to next node in list    */
  48. } CList ;
  49.  
  50. /* Global Variables    */
  51. #ifdef MAIN
  52. #define GLOBAL
  53. #else
  54. #define GLOBAL extern
  55. #endif
  56.  
  57. //GLOBAL int getopt(int, char *[], char *);
  58. //GLOBAL int optind, opterr;
  59. //GLOBAL char *optarg;
  60. GLOBAL Vector new_v1, new_v2, new_v3;    /* storage for inbound tri's    */
  61. GLOBAL Point *p_root;            /* top of Point list        */
  62. GLOBAL Triangle *t_root;        /* top of Triangle list        */
  63. GLOBAL Point *last_point;        /* ptr to end of point list    */
  64. GLOBAL int tri_cnt, pt_cnt, cl_cnt;    /* counts for error reporting    */
  65. GLOBAL int debug, quiet, format;    /* misc cmd line flags        */
  66. GLOBAL void (*out_func)(void);        /* pointer to output function    */
  67.  
  68. /* Function Prototypes    */
  69. #define PROTO                /* just something to grep for    */
  70.  
  71. /* from Main.C    */
  72. PROTO      int   main(int, char *[]);
  73. PROTO     void     df_erx(char *);
  74. PROTO     void   erx(char *);
  75. PROTO     void   instr(char *);
  76.  
  77. /* from SP.C    */
  78. PROTO     void   sp(void);
  79. PROTO    Point * pt_alloc(void);
  80. PROTO    Point * find_point(Vector *);
  81. PROTO    Point * pt_save(Vector *, Triangle *);
  82. PROTO    CList * cl_alloc(void);
  83. PROTO    CList * end_of_list(CList *);
  84. PROTO Triangle * tri_alloc(void);
  85. PROTO      int   read_triangle(void);
  86. PROTO     void   walk_clist(CList *);
  87. PROTO     void   walk_points(void);
  88. PROTO     void   walk_triangles(void);
  89.  
  90. /* from Normal.C    */
  91. PROTO void calc_tri_normal(Triangle *);
  92. PROTO void calc_pt_normals(void);
  93.  
  94. /* from File.C    */
  95. PROTO void raw_out(void);
  96. PROTO void nff_out(void);
  97. PROTO void viv_out(void);
  98. PROTO void viv1_out(void);
  99. PROTO void rsh_out(void);
  100. PROTO void pov_out(void);
  101. PROTO void dkb_out(void);
  102.  
  103. /*** eof ****************************************************************/
  104.